/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.hpvas.gui;

import java.awt.Color;

/**
 *
 * @author sony
 */
public class SearchPanel extends javax.swing.JPanel {

    /**
     * Creates new form SearchPanel
     */
    public SearchPanel() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jToolBar1 = new javax.swing.JToolBar();
        searchTextJT = new javax.swing.JTextField();
        searchButtonJB = new javax.swing.JButton();

        jToolBar1.setRollover(true);

        searchTextJT.setForeground(new java.awt.Color(204, 204, 204));
        searchTextJT.setText("Search veterinarians, Owners or pets");
        searchTextJT.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                searchTextJTMouseClicked(evt);
            }
        });
        searchTextJT.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                searchTextJTActionPerformed(evt);
            }
        });
        jToolBar1.add(searchTextJT);

        searchButtonJB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/edu/hpvas/resourses/searchIcon.jpg"))); // NOI18N
        searchButtonJB.setFocusable(false);
        searchButtonJB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        searchButtonJB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        searchButtonJB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                searchButtonJBActionPerformed(evt);
            }
        });
        jToolBar1.add(searchButtonJB);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 410, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(150, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(308, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void searchButtonJBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonJBActionPerformed

        if(searchTextJT.getText().equals("Search veterinarians, Owners or pets")){
            searchTextJT.setForeground(Color.red);
            searchTextJT.setText("This field cannot be blank");
        }
    }//GEN-LAST:event_searchButtonJBActionPerformed

    private void searchTextJTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchTextJTActionPerformed
        
    }//GEN-LAST:event_searchTextJTActionPerformed

    private void searchTextJTMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_searchTextJTMouseClicked
        if(searchTextJT.getText().equals("Search veterinarians, Owners or pets")){
            searchTextJT.setText("");
            searchTextJT.setForeground(Color.black);
        }
    }//GEN-LAST:event_searchTextJTMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JButton searchButtonJB;
    private javax.swing.JTextField searchTextJT;
    // End of variables declaration//GEN-END:variables
}
